$(function(){
	$('.Search_Results').hover(function() {

        $(this).addClass('onhover');

      }, function() {

        $(this).removeClass('onhover');

      });
	});



$(document).ready(function()
		{
			$("#selectAllresult").click(function()
			{
				var para="";
                                var v=document.getElementsByName("selectResult");
                                for (i=0;i<v.length;i++)
                                    {
                                        v[i].checked=true;

                                        if (para!="")
						{
							para=para+","
						}
				para= para + v[i].value;


                                    }
				
                                setFilter("1",para);
			});
		});



$(document).ready(function()
		{
			$("#unselectAllresult").click(function()
			{

                                var v=document.getElementsByName("selectResult");
                                for (i=0;i<v.length;i++)
                                    {
                                        v[i].checked=false;
                                    }


                                setFilter("1","");
			});
		});

function setFilter(flg,pav,year_para_val,rtval)
{

var chk=document.getElementsByName("selectResult");
var para="";

if (flg=="1")
    {

        para=pav;
    }
else if (flg=="2")
    {
for (var i=0; i < chk.length; i++)
	   {
			if (chk[i].checked==true)
			{
				if (para!="")
						{
							para=para+","
						}
				para= para + chk[i].value;
			}


		}
    }
    if (rtval!=undefined && rtval==true)
        {
            return para;
        }
            setSessionforhistory(para);

            LoadData(para);
     if(para!=null && para!="")
         {loadMarker(map,para);} else {loadMarker(map,"");}
   
   // Calls the Chart function on click of each checkbox from right panel
   if($("#reportarea").is(":visible")==true){DrawChart(para,year_para_val);}
}

function tbvalue(obj)
{

}

function setSessionforhistory(str)
{
if (str!="")
    {
        
        if (window.sessionStorage.getItem('history')!=null && window.sessionStorage.getItem('history')!="")
            {

                    if(window.sessionStorage.getItem('history').match(str)==null)
                        {window.sessionStorage.setItem('history',window.sessionStorage.getItem('history') + ","+ str);}
                
            }
            else
            {
                
                
                    window.sessionStorage.setItem('history',str);
                    

            }


}
   
}
function LoadData(selectedvalues)
{



                                 $("#citation").html('<img src="/images/loading/loading9.gif">');

				$.post("http://"+location.hostname+"/citation/Index", {search: selectedvalues}, function(data) {
                                $("#citation").html(data);
                                });
}


